﻿using NAnt.SVN.Tasks.Constants;
using NAnt.Core.Attributes;
using NAnt.SVN.Attributes;
using System.IO;

namespace NAnt.SVN.Tasks
{
    /// <summary>
    /// Superclass of the propset command to auto-ignore common build folders
    /// The folders bin and obj are included, other folders can be specified
    /// You can run this tasc with the svnignore tag in NAnt.
    /// $Id$
    /// </summary>
    [TaskName("svnignore")]
    public sealed class Ignore : PropSet
    {
        #region Private Fields

        private string value = "bin";

        #endregion

        /// <summary>
        /// The property is fixed here: keywords
        /// </summary>
        public override string Property
        {
            get
            {
                return SVNProperties.IGNORE;
            }

        }

        /// <summary>
        /// The property value
        /// </summary>
        [TaskAttribute("value", Required = true)]
        [StringValidator()]
        public override string Value
        {
            get
            {
                return value;
            }
            set
            {
                this.value = value;
            }
        }

        /// <summary>
        /// Use the projects base directory as the single file
        /// </summary>
        public override FileInfo File
        {
            get
            {
                return new System.IO.FileInfo(Project.BaseDirectory);
            }
        }

        /// <summary>
        /// Recurse
        /// </summary>
        public override bool Recursive
        {
            get
            {
                return true;
            }
        }
    }
}
